
module Scale_Adapter
#(
    parameter iWIDTH = 32,
    parameter oWIDTH = 10
)
(
    input wire signed [iWIDTH-1:0] i_SignalInput,
    input wire i_clk,
    input wire i_rst,
    output reg signed [oWIDTH-1:0] o_SignalOutput
);

reg signed [oWIDTH-1:0] scaled_signal;

always@(*) begin
    if(iWIDTH>oWIDTH) begin
        scaled_signal=i_SignalInput[iWIDTH-1:iWIDTH-oWIDTH];
    end
    else if(iWIDTH<oWIDTH) begin
        scaled_signal={i_SignalInput[iWIDTH-1:0],{(oWIDTH-iWIDTH){i_SignalInput[0]}}};
    end
    else begin
        scaled_signal=i_SignalInput;
    end
end

always@(posedge i_clk or posedge i_rst) begin
    if(i_rst) begin
        o_SignalOutput<='b0;
    end
    else begin
        o_SignalOutput<=scaled_signal;
    end
end

endmodule